package com.leanyuan.main.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.leanyuan.main.domain.Building;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.FetchType;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 相亲相爱一家人
 * @since 2021-05-25
 */
@Repository
public interface BuildingMapper_M extends BaseMapper<Building> {
    @Results(id = "BuildMap",value = {@Result(column = "BUILDING_ID", property = "buildingId"),
            @Result(column = "ADMIN_ID", property = "adminId"),
            @Result(column = "NAME", property = "name"),
            @Result(column = "AREA", property = "area"),
            @Result(column = "ADDTIME", property = "addtime"),

            @Result(column = "BUILDING_ID", property = "houseList",
                    many = @Many(select = "com.leanyuan.dao.HouseMapper.findBuild", fetchType = FetchType.LAZY))
    })
    @Select("select * from building")
    public List<Building> findBuild();

}
